package com.whmskj.xjlhsc.qianYiData.service.impl;

import com.whmskj.xjlhsc.qianYiData.mapper.DailyPowerSupplyCopyMapper;
import com.whmskj.xjlhsc.qianYiData.service.DailyPowerSupplyCopyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;

@Service
public class DailyPowerSupplyCopyServiceImpl implements DailyPowerSupplyCopyService {

    @Resource
    private DailyPowerSupplyCopyMapper mapper;

    @Override
    public int syncDay(LocalDate day) {
        if (day == null) day = LocalDate.now();
        int updated = mapper.updateFromShift(day);
        int inserted = mapper.insertMissingFromShift(day);
        return updated + inserted;
    }
}

